worker_processes <%= p('blobstore.nginx.workers') %>;
daemon off;

pid       /var/vcap/data/blobstore/blobstore.pid;
error_log /var/vcap/sys/log/blobstore/error.log warn;

events {
  worker_connections 8192;
}

http {
  include      /var/vcap/jobs/blobstore/config/mime.types;
  default_type application/octet-stream;

  client_body_temp_path /var/vcap/data/blobstore/tmp/client_body;
  proxy_temp_path /var/vcap/data/blobstore/tmp/proxy;
  fastcgi_temp_path /var/vcap/data/blobstore/tmp/fastcgi;
  uwsgi_temp_path /var/vcap/data/blobstore/tmp/uwsgi;
  scgi_temp_path /var/vcap/data/blobstore/tmp/scgi;

  map $status $severity {
    ~^[23]  1;
    default 7;
  }

  log_format common_event_format 'CEF:0|CloudFoundry|BOSH|-|blobstore_api|$request_uri|$severity|'
                                 'requestClientApplication=$remote_user '
                                 'requestMethod=$request_method '
                                 'src=$remote_addr spt=$remote_port '
                                 'cs1=Basic cs1Label=authType '
                                 'cs2=$status cs2Label=responseStatus';

  access_log	  /var/vcap/sys/log/blobstore/access.log common_event_format;
  server_tokens off;

  sendfile    on;
  sendfile_max_chunk 256m;
  tcp_nopush  on;
  tcp_nodelay on;

  keepalive_timeout 75 20;

  gzip                 on;
  gzip_min_length      1250;
  gzip_buffers         16 8k;
  gzip_comp_level      2;
  gzip_proxied         any;
  gzip_types           text/plain text/css application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  gzip_vary            on;
  gzip_disable         "MSIE [1-6]\.(?!.*SV1)";

  include /var/vcap/jobs/blobstore/config/sites/*;
}
